(function(global){
	global=global||window;
	global.alert=function(){
	
	};
	global.LayaMakerMarket=SPSDK.constructor;
	LayaMakerMarket.prototype.onShow = function(data){
		if( !data ){
			data = wx.getLaunchOptionsSync();
		}
		var _param=null;
		if( data && data.query ){
			_param = data.query;
		}
		if(!_param) return;		
		delete _param.ald_share_src;
		if(wx.aldSendEvent)
			wx.aldSendEvent("shareOnShow",{param:JSON.stringify(_param)});
		//this.sendEventStatistics();
	};
	LayaMakerMarket.prototype.sendShare=function(title, image_url, share_param, callback, canvas, isInit){
		wx.onShareAppMessage = wx.aldOnShareAppMeassage;
		wx.shareAppMessage = wx.aldShareAppMessage;
		var _param = {};
		_param.imgsrc = image_url;
		_param.canvas = canvas;
		_param.title = title;
		_param.ext = share_param;
		if(isInit){
			this.initShareInfo(_param,function(data){
				callback(JSON.parse(data));
			}  );
		}else{
			this.share(_param,function(data){
				callback(JSON.parse(data));
			});
		}
	};
	
	LayaMakerMarket.prototype.showADVideo=function(adUnitId,callback){
		
		this.showRewardVideo(adUnitId,function(data){
			data=JSON.parse(data);
			switch(data.result){
				case 0:
				callback(1,data.desc);
				break;
				case -1:
				callback(0,data.desc);
				break;
				case -2:
				callback(-1,data.desc);
				break;
			}
		});
	};

	LayaMakerMarket.prototype.showADBanner=function(adUnitId, style, destroy, callback){
		this.showBannerAD(adUnitId, style, destroy, function(data){
			 switch(data.result){
				 case 0:
				 callback(data,data.desc);
				 break;
				 default:
				 callback(data,data.desc);
				 break;
			 }
		});
	};
	
		
	LayaMakerMarket.prototype.hideADBanner=function(adUnitId, callback){
		this.hideBannerAD(adUnitId, callback);
	};
	
	
})(this);

